package com.gec.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gec.model.system.ITripHotelOrder;
import com.gec.model.system.ITripItineraryOrder;
import com.gec.model.system.ITripServiceOrder;
import com.gec.model.vo.ITripHotelOrderVo;
import com.gec.model.vo.ITripItineraryVo;
import com.gec.system.mapper.ITripHotelOrderMapper;
import com.gec.system.service.ITripHotelOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 订单表 服务实现类
 * </p>
 *
 * @author dafei
 * @since 2024-01-25
 */
@Service
public class ITripHotelOrderServiceImpl extends ServiceImpl<ITripHotelOrderMapper, ITripHotelOrder> implements ITripHotelOrderService {


    @Override
    public IPage<ITripHotelOrder> selectPage(IPage<ITripHotelOrder> page1, ITripHotelOrderVo iTripHotelOrderVo) {
        IPage<ITripHotelOrder> iPage = this.baseMapper.selectPage(page1,iTripHotelOrderVo,null) ;
        return iPage;
    }

    @Override
    public List<ITripHotelOrder> getByIsPaid(Long isPaid) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("isPaid",isPaid);//相当于where name=1
        List<ITripHotelOrder> list = baseMapper.selectList(wrapper);
        return list;
    }

    @Override
    public List<ITripHotelOrder> getByUserId(Long id) {

        List<ITripHotelOrder> list = baseMapper.getAllByUserId(id);
        return list;
    }

    @Override
    public Long getNumberByRoomId(Long i) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("roomId",i);//相当于where name=1
        List<ITripHotelOrder> list = baseMapper.selectList(wrapper);
        return list.get(0).getNumber();
    }
}
